NOTE

1.14 Elasticsearch merge

English translation of the original VNote ‘Elasticsearch merge’, preserving its structure and historical learning notes.

Elasticsearch / SearchCreated Updated 1 min readhistorical

This is a historical learning note and may contain outdated or incomplete understanding.

1. What Is merge?

  • In Elasticsearch, a shard is a Lucene Index, and a Lucene Index is composed of segments.
  • A segment is immutable. The merge operation combines multiple small segments into one large segment.

2. Why Is merge Needed?

  • Every refresh generates a small segment. As time passes, the number of segments increases, and every search needs to scan all segments, which reduces query efficiency.
  • Perform physical deletion of Elasticsearch data. Elasticsearch Data Read/Write Flow.md (original link is no longer valid).

3. When merge Is Triggered

3.1. Automatic

3.2. Manual

POST /my-index-000001/_forcemerge
POST /my_index/_optimize?max_num_segments=1

4. merge Process

5. References

Discussion

Sign in with GitHub to comment. Discussions are stored as GitHub Issues.View on GitHub